Changed functions and some adjustments