Added multi queries and changed way of calling functions