added more code structure to main, added check function for style selection