memory optimalizations
using pointers
removed sleep