cleaned up code and helpers