rewrote everythign to suit my needs