reorganized old version
updated to lastest version
minor changes in coding style