clean up, use make functions instead of subshells, remove unused stuff