fixed genCode when used in other directories
changed layout to make it more package-like