Cleaned up for threading issues, also added all the methods