cleaded up code a little