some code moved to form