profile code, add documentation