code cleanup & client-side logic