working - code needs checks and cleaning