Cleaned up, tested a bit