Added watch option

Added option to watch for file changes
Restructured code