reverted to procedural until i have time to make a proper OO module