remove debug
add two methods
improved template