at last. its working
done. need improvements and checking for bugs