Optimizing a lot of the exisiting code.