edited source and tested