Refining layout and fixing some bugs