working version with minor bug corrected
commit all files