added main() and some edits to code