Fixing some stuff and compiling into one script