Cleaned up internals