fixes comments and optimisations
fixes comments and optimisations