copied most usr functions