added c functionality