javascript cleaned up