updated sgs, implemented more wrapping functions