Cleaned up, added tests. Feature complete.