minor changes
- changed logic
- fixed some minor errors