updated code...still under development