Cleaned up but still needs comments