bugs fixed now working version