implementation of all relevant functions