working version

added and debugged