making some functions
mergin work into master