Cleaned up a few functions