functional, better logic layout