first algorithm (retarded, but working version)
and classpath