CFY-1124 modified code to import ctx instead of receiving it as a parameter