new functions and small bug fixes
adjusted some stuff to match current structure