Fixing bugs and updated model