re-structured code into smaller files