Fixed singleton usage issues, cleaned up data structures