Removing / optimizing code