Fixed bugs and finished core