Small changes and implementation of some new functions