fixed a bug in model
cleaned up in controller