Moved code under a main method; re-organize