finally got code ready for testing