Move all functions to prototypes and put them outside constructor

Signed-off-by: Juan Martin Runge <jmrunge@gmail.com>