fixed, now working version, still not ready with classes