indentation and redundant main() fixed