refactor of implementation: functions and struct types added