Clean up, add documentation