Updated to fix several issues