fixed bugs & refactored model...