Cleaned up some more functions