removed unnecessary Main; minor code style improvements