added advanced cuts and fixed more bugs