functions added and bugs fixed