merged messed up code