Fixing behavior to have more advanced functioanlity. Could use a touch of refactoring