Added custom procedures and fixed some issues