Moved parts to lib directory, put main constants in modules.