First functional version
Clean up