Cleaned up code. Found bug. Fixing awaits