refactoring code, adding function to env
moved templating code to library
tidying library code
modularized library code
added hidden property to object