Cleaned up, hopefully didn't break anything