Got rid of delay in code and general cleanup