fixed some bugs and added the remaining controls