update code to psr-2 standard and add missing visibility on functions