add all functions but with bugs