Cleaned up some functionality