further modularized code, worked on interface