Expanding options and cleaning up code