moving code from sketch to libraries