First version, works but isn't perfect.