Running in background mode fixed. Removed unnecessary methods. Sped up a few locks.