fixed various bugs and working alpha version