cleaned code for more commonality