adding auto rotate & refactor (under construction)