Note about opt
Fixed really retarded mistake
Restructured the code to be more readable - same functionality