Implemented functions for the brain

Code cleaning