implementation of supporting functions