refine code and fix footer issue