moved from .h back to .cpp as functions, less code this way