changed the structure a little. now it should be less code