restructured modules and added code for CLI