better foldering and bug fixes