Added new methods, cleaned up code and fixed some compiler warnings