Moving general functions from lightship to utils