Added controller support, fixed some bugs