Refactor. 

Removed unnecessary functions for my project and normalize the outputs.