added functions, semi-broken