use components instead of own code

like mentioned in the comment.