table borders

initial, working version, will be refactored and optimized in the future