Refactor layouthint js