rafactored to be as simple as can be