refactor code. fix desktop layout issues.