moving phyghtmap call into function