First version, uncommented finished