Fix some bugs and finishing touches