main body; fix bugs