Implemented pause function, now works properly.